import java.util.Scanner;


public class Clock {

	static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		print("Enter a time (In the format \"1230\" for 12:30)");
		while(true){			
			int Time = in.nextInt();
			int minutes = Time % 100;
			int HourSec = 360 / 12;
			int Hours = Time - minutes;
			double HourPercent = minutes / 60.0;
			double Degrees = 0;
			double MinuteDegrees = 0;
			System.out.println("Time: " + Time + "   Hours: " + Hours + "   Minutes: " + minutes);
			Degrees = HourSec * Hours / 100;
			Degrees += HourPercent * HourSec;
			if(Degrees > 360) Degrees -= 360;
			MinuteDegrees = HourPercent * 360.0;
			
			if(Degrees > MinuteDegrees) {
				Degrees -= MinuteDegrees;
			} else {
				Degrees = MinuteDegrees - Degrees;
			}

			if(Degrees >= 180) Degrees = 360 - Degrees;

			System.out.println(Degrees);
		}
	}

	public static void print(String str) {
		System.out.println(str);
	}

}
